26 PART 1 Getting Started with Biostatistics

Higher-dimensional arrays

Two-dimensional arrays can be understood as a table of values with rows and

columns, like a block of cells in a spreadsheet. There are also higher-dimensional

arrays that can be thought of as a whole collection of tables. Suppose that you

measure the fasting glucose on five participants on each of three treatment days.

You could think of your 15 measurements being laid out in a table with five rows

and three columns. If you want to represent this entire table with a single variable

name like Gluc, you can use double-indexing, with the first index specifying the

participant (1 through 5), and the second index specifying the day of the measure-

ment (1 through 3). Under that system, Gluc[3,2] indicates the fasting glucose

measurement for participant 3 on day 2. To express the array as a formula, we

would use the expression Gluc[i,j], which specifies the fasting glucose for the ith

subject on the jth day.

Special terms may be used to refer to arrays with one or two dimensions:»

» A one-dimensional array is also referred to as a vector. But this can be

confusing, because the term vector is also used in mathematics, physics, and

biology to refer to completely different concepts.»

» A two-dimensional array is sometimes called a matrix (plural: matrices). To

some, this term implies we are using a set of mathematical rules called matrix

algebra, and that’s not entirely incorrect. Mathematical descriptions of

multiple regression (covered in Chapter 17 of this book) make extensive use

of matrix algebra. Also, computer software may refer to tabular objects with

the term matrix.

Arrays in formulas

If you see an array name in a formula without any subscripts, it usually means

that you have to evaluate the formula for each element of the array, and the result

is an array with the same number of elements. So, if Gluc refers to the array with

the five elements 86, 110, 95, 125, and 64, then the expression 2 × Gluc results in

an array with each element in the same order multiplied by two: 172, 220, 190,

250, and 128.

When an array name appears in a formula with subscripts, the meaning depends

upon the context. It can indicate that the formula is to be evaluated only for some

elements of the array, or it can mean that the elements of the array are to be com-

bined in some way before being used (as described in the next section).